package coc

import (
	"fmt"
	"strconv"
	"trpg-message/entity"
)

type Cocgf struct {
}

func (cocgf Cocgf) Handle(message entity.Message, argStr string) string {
	if argStr == "" {
		_, greatFail := roomDao.GetGreatSuccessAndGreatFail(message.RoomId)
		return fmt.Sprintf("本群大失败为%v", greatFail)
	} else {
		gf, err := strconv.Atoi(argStr)
		if err != nil {
			return "错误的参数，请输入数字捏~"
		} else {
			roomDao.SetGreatFail(message.RoomId, int32(gf))
			return fmt.Sprintf("本群大失败修改成功，现在为%v", gf)
		}
	}
}
